<!--
  ~ Electronic Logistics Management Information System (eLMIS) is a supply chain management system for health commodities in a developing country setting.
  ~
  ~ Copyright (C) 2015  John Snow, Inc (JSI). This program was produced for the U.S. Agency for International Development (USAID). It was prepared under the USAID | DELIVER PROJECT, Task Order 4.
  ~
  ~ This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  ~
  ~ This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Affero General Public License for more details.
  ~
  ~ You should have received a copy of the GNU Affero General Public License along with this program.  If not, see <http://www.gnu.org/licenses/>.
  -->
<div xmlns="http://www.w3.org/1999/html" tab-scroll>
    <h2 openlmis-message="header.help.helptopic.title"></h2>

    <div class="alert alert-success" id="saveSuccessMsgDiv" ng-bind="message" ng-show="message"/>

    <!-- Add Product -->
    <form ng-submit="updateHelpTopic()" id="editHelpCategoryForm" name="editHelpCategoryForm"
          novalidate select2-blur>

        <div>


            <div class="row">

                <fieldset class="span2">
                    <!-- help category -->


                    <!-- Help level-->
                    <div class="form-cell">
                        <label for="level" openlmis-message="label.help.helptopic.level"><span
                                class="label-required"> *</span></label>

                        <div class="form-field" style="width: 40%;">
                            <input ng-model="editHelpTopic.level" name="level" id="level" type="text"
                                   ng-required="true"/>
        <span class="field-error"
              ng-show="createHelpCategoryForm.level.$error.required && showError"
              openlmis-message="missing.value">
        </span>
                        </div>
                    </div>

                    <!--Help Topic name-->
                    <div class="form-cell">
                        <label for="name" openlmis-message="label.help.helptopic.name"><span
                                class="label-required"> *</span></label>

                        <div class="form-field" style="width: 40%;">
                            <input ng-model="editHelpTopic.name" name="name" id="name" type="text"
                                   maxlength="150"
                                   ng-required="true"/>
        <span class="field-error"
              ng-show="createHelpCategoryForm.name.$error.required && showError"
              openlmis-message="missing.value">
        </span>
                        </div>
                        <div>
                            <div class="form-cell">
                                <label for="name" openlmis-message="label.help.helptopic.selectRole"><span
                                        class="label-required"> *</span></label>
                                </div>
                            <table class="table table-striped table-bordered">
                                <thead>
                                <tr class="gradient-header">
                                    <th> <a href="" ng-click="selectAll()">Select All</a>|
                                        <a href="" ng-click="deSelectAll()">None</a>
                                    </th>
                                    <th openlmis-message="label.help.helptopic.name">Name</th>
                                    <th openlmis-message="label.help.helptopic.descripton"></th>


                                </tr>
                                </thead>
                                <tbody>
                                <tr ng-repeat="r in editHelpTopic.roleList | orderBy:['displayOrder','userRole.name']">
                                    <td><input ng-model="r.currentlyAssigned" name="selected" id="selected"
                                               type="checkbox"

                                               ng-required="false"/>
                                    </td>
                                    <td>
                                        <div>{{r.userRole.name}}</div>
                                    </td>
                                    <td>
                                        <div>{{r.userRole.description}}</div>
                                    </td>



                                </tr>
                                </tbody>
                            </table>
                        </div>
                    </div>



                </fieldset>

            </div>




            <div form-toolbar id="action_buttons" class="action-buttons">
                <div class="form-cell button-row">
                    <input type="submit" class="btn btn-primary save-button" openlmis-message="button.save"/>
                    <a ng-click="cancel()" class="btn btn-cancel cancel-button"><span
                            openlmis-message="button.cancel"></span></a>
                </div>
                <div class="toolbar-error" id="saveErrorMsgDiv" ng-show="showError || error">{{ errorMessage }}</div>
            </div>

        </div>
    </form>

</div>




